﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Krilib;
using System.Xml.Serialization;

namespace Wassrile.Config
{
    public class Account
    {
        public string UserName;

        public enum CredentialTypes { BASIC, Token };
        public CredentialTypes CredentialType;

        [XmlIgnore()]
        public string PasswordOrToken;

        public string PassToken
        {
            get { return Bridge.CommonOperation.AESEncrypt(PasswordOrToken); }
            set
            {
                try
                {
                    this.PasswordOrToken = Bridge.CommonOperation.AESDecrypt(value);
                }
                catch (Exception e)
                {
                    Bridge.DebugReporter.AddReport(e);
                    this.PasswordOrToken = "";
                }
            }
        }
    }
}
